package com.my.netty.promote.server.service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 基于内存的UserService实现
 */
public class UserServiceMemoryImpl implements UserService{

    private Map<String, String> userPasswordMap = new ConcurrentHashMap<>();

    public UserServiceMemoryImpl() {
        userPasswordMap.put("zhangsan", "123");
        userPasswordMap.put("lisi", "123");
        userPasswordMap.put("wangwu", "123");
        userPasswordMap.put("zhaoliu", "123");
    }

    @Override
    public boolean login(String username, String password) {
        return password.equals(userPasswordMap.get(username));
    }
}
